<%= lines(autogen_notice(:ruby, pwd)) -%>
<% vcr_mode = ENV['VCR_MODE'] -%>
<% raise "Bad VCR_MODE environment variable set. Should be nil, 'none' or 'all'" unless vcr_mode.nil? || vcr_mode == 'all' || vcr_mode == 'none' -%>
<% if vcr_mode -%>
<%= "require 'vcr'" %>
<%= "require 'vcr_config'" %>
<% end # if vcr_mode -%>

title 'Test GCP <%= name -%> resource.'

<%= compile(pwd + "/templates/inspec/examples/#{attribute_file_name}/#{attribute_file_name}_attributes.erb") -%>

control '<%= name -%>-1.0' do
  impact 1.0
  title '<%= name -%> resource test'

<% if privileged -%>
  only_if { gcp_enable_privileged_resources.to_i == 1 && gcp_organization_id != '' }
<% end # if privileged -%>
<% if vcr_mode -%>
  VCR.use_cassette('<%= name -%>', :record => :<%= vcr_mode -%>) do
<% end # if vcr_mode -%>
<%= indent(compile(pwd + "/templates/inspec/examples/#{attribute_file_name}/#{name}.erb"), vcr_mode ? 4 : 2) %>
<% if vcr_mode -%>
	end
<% end # if vcr_mode -%>
end